/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tracker.android.com.impl;

import ecore.EcorePackage;

import ecore.impl.EcorePackageImpl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import tracker.android.com.BluetoothDevice;
import tracker.android.com.BluetoothService;
import tracker.android.com.ComFactory;
import tracker.android.com.ComPackage;
import tracker.android.com.IBluetooth;
import tracker.android.com.ICommService;
import tracker.android.com.ICommunication;
import tracker.android.com.ICommunication_COM_TYPE_ENUM;
import tracker.android.com.IDevice;
import tracker.android.com.ISocket;
import tracker.android.com.IWireless;

import tracker.android.com.State;
import tracker.android.nativelib.NativelibPackage;
import tracker.android.nativelib.impl.NativelibPackageImpl;
import tracker.android.sens.SensPackage;

import tracker.android.sens.impl.SensPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ComPackageImpl extends EPackageImpl implements ComPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iCommunicationEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iDeviceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iSocketEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iCommServiceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iWirelessEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iBluetoothEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass bluetoothServiceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass bluetoothDeviceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum iCommunication_COM_TYPE_ENUMEEnum = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum stateEEnum = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see tracker.android.com.ComPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private ComPackageImpl() {
		super(eNS_URI, ComFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link ComPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static ComPackage init() {
		if (isInited) return (ComPackage)EPackage.Registry.INSTANCE.getEPackage(ComPackage.eNS_URI);

		// Obtain or create and register package
		ComPackageImpl theComPackage = (ComPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ComPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ComPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		NativelibPackageImpl theNativelibPackage = (NativelibPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) instanceof NativelibPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) : NativelibPackage.eINSTANCE);
		SensPackageImpl theSensPackage = (SensPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI) instanceof SensPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI) : SensPackage.eINSTANCE);
		tracker.pc.com.impl.ComPackageImpl theComPackage_1 = (tracker.pc.com.impl.ComPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(tracker.pc.com.ComPackage.eNS_URI) instanceof tracker.pc.com.impl.ComPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(tracker.pc.com.ComPackage.eNS_URI) : tracker.pc.com.ComPackage.eINSTANCE);
		EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) : EcorePackage.eINSTANCE);

		// Create package meta-data objects
		theComPackage.createPackageContents();
		theNativelibPackage.createPackageContents();
		theSensPackage.createPackageContents();
		theComPackage_1.createPackageContents();
		theEcorePackage.createPackageContents();

		// Initialize created meta-data
		theComPackage.initializePackageContents();
		theNativelibPackage.initializePackageContents();
		theSensPackage.initializePackageContents();
		theComPackage_1.initializePackageContents();
		theEcorePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theComPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(ComPackage.eNS_URI, theComPackage);
		return theComPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getICommunication() {
		return iCommunicationEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getIDevice() {
		return iDeviceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getISocket() {
		return iSocketEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getICommService() {
		return iCommServiceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getIWireless() {
		return iWirelessEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getIBluetooth() {
		return iBluetoothEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getBluetoothService() {
		return bluetoothServiceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getBluetoothService_NAME() {
		return (EAttribute)bluetoothServiceEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getBluetoothService_TAG() {
		return (EAttribute)bluetoothServiceEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getBluetoothService_MAdaptor() {
		return (EReference)bluetoothServiceEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getBluetoothService_MHandler() {
		return (EReference)bluetoothServiceEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getBluetoothService_MState() {
		return (EAttribute)bluetoothServiceEClass.getEStructuralFeatures().get(4);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getBluetoothDevice() {
		return bluetoothDeviceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getBluetoothDevice_Services() {
		return (EReference)bluetoothDeviceEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getICommunication_COM_TYPE_ENUM() {
		return iCommunication_COM_TYPE_ENUMEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getState() {
		return stateEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComFactory getComFactory() {
		return (ComFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		iCommunicationEClass = createEClass(ICOMMUNICATION);

		iDeviceEClass = createEClass(IDEVICE);

		iSocketEClass = createEClass(ISOCKET);

		iCommServiceEClass = createEClass(ICOMM_SERVICE);

		iWirelessEClass = createEClass(IWIRELESS);

		iBluetoothEClass = createEClass(IBLUETOOTH);

		bluetoothServiceEClass = createEClass(BLUETOOTH_SERVICE);
		createEAttribute(bluetoothServiceEClass, BLUETOOTH_SERVICE__NAME);
		createEAttribute(bluetoothServiceEClass, BLUETOOTH_SERVICE__TAG);
		createEReference(bluetoothServiceEClass, BLUETOOTH_SERVICE__MADAPTOR);
		createEReference(bluetoothServiceEClass, BLUETOOTH_SERVICE__MHANDLER);
		createEAttribute(bluetoothServiceEClass, BLUETOOTH_SERVICE__MSTATE);

		bluetoothDeviceEClass = createEClass(BLUETOOTH_DEVICE);
		createEReference(bluetoothDeviceEClass, BLUETOOTH_DEVICE__SERVICES);

		// Create enums
		iCommunication_COM_TYPE_ENUMEEnum = createEEnum(ICOMMUNICATION_COM_TYPE_ENUM);
		stateEEnum = createEEnum(STATE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
		NativelibPackage theNativelibPackage = (NativelibPackage)EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI);
		SensPackage theSensPackage = (SensPackage)EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		iWirelessEClass.getESuperTypes().add(this.getICommunication());
		iBluetoothEClass.getESuperTypes().add(this.getICommunication());
		bluetoothServiceEClass.getESuperTypes().add(this.getICommService());
		bluetoothDeviceEClass.getESuperTypes().add(this.getIDevice());
		bluetoothDeviceEClass.getESuperTypes().add(this.getIBluetooth());

		// Initialize classes and features; add operations and parameters
		initEClass(iCommunicationEClass, ICommunication.class, "ICommunication", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		addEOperation(iCommunicationEClass, this.getICommunication_COM_TYPE_ENUM(), "getCommType", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(iDeviceEClass, IDevice.class, "IDevice", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		addEOperation(iDeviceEClass, theEcorePackage.getEString(), "getName", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(iSocketEClass, ISocket.class, "ISocket", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(iCommServiceEClass, ICommService.class, "ICommService", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		EOperation op = addEOperation(iCommServiceEClass, this.getISocket(), "connect", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, this.getIDevice(), "device", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(iCommServiceEClass, this.getIDevice(), "getDeviceList", 0, -1, IS_UNIQUE, !IS_ORDERED);

		initEClass(iWirelessEClass, IWireless.class, "IWireless", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(iBluetoothEClass, IBluetooth.class, "IBluetooth", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		addEOperation(iBluetoothEClass, this.getICommService(), "getServices", 0, -1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(iBluetoothEClass, theEcorePackage.getEBoolean(), "hasService", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEString(), "UUID", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(bluetoothServiceEClass, BluetoothService.class, "BluetoothService", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getBluetoothService_NAME(), theEcorePackage.getEString(), "NAME", null, 1, 1, BluetoothService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getBluetoothService_TAG(), theEcorePackage.getEString(), "TAG", null, 1, 1, BluetoothService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEReference(getBluetoothService_MAdaptor(), theNativelibPackage.getBluetoothAdaptor(), null, "mAdaptor", null, 1, 1, BluetoothService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEReference(getBluetoothService_MHandler(), theNativelibPackage.getHandler(), null, "mHandler", null, 1, 1, BluetoothService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getBluetoothService_MState(), this.getState(), "mState", null, 1, 1, BluetoothService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "BluetoothService", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theNativelibPackage.getContext(), "context", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theNativelibPackage.getHandler(), "handler", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "connect", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, this.getBluetoothDevice(), "device", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "connected", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theNativelibPackage.getBluetoothSocket(), "socket", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, this.getBluetoothDevice(), "device", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(bluetoothServiceEClass, null, "start", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(bluetoothServiceEClass, null, "stop", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(bluetoothServiceEClass, theEcorePackage.getEInt(), "getState", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(bluetoothServiceEClass, null, "connectionFailed", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "setState", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "state", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "write", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEByte(), "out", 0, -1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "size", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(bluetoothServiceEClass, null, "connectionLost", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(bluetoothServiceEClass, null, "write", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEByte(), "out", 0, -1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "size", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theSensPackage.getThread(), "senderThread", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(bluetoothDeviceEClass, BluetoothDevice.class, "BluetoothDevice", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getBluetoothDevice_Services(), this.getBluetoothService(), null, "services", null, 0, -1, BluetoothDevice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		// Initialize enums and add enum literals
		initEEnum(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.class, "ICommunication_COM_TYPE_ENUM");
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_BLUETOOTH);
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_WLAN);
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_SERIAL);
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_ETHERNET);
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_CAN);
		addEEnumLiteral(iCommunication_COM_TYPE_ENUMEEnum, ICommunication_COM_TYPE_ENUM.COM_TYPE_FLEXRAY);

		initEEnum(stateEEnum, State.class, "State");
		addEEnumLiteral(stateEEnum, State.NONE);
		addEEnumLiteral(stateEEnum, State.LISTEN);
		addEEnumLiteral(stateEEnum, State.CONNECTING);
		addEEnumLiteral(stateEEnum, State.CONNECTED);

		// Create resource
		createResource(eNS_URI);
	}

} //ComPackageImpl
